package com.juyu.miliao.common.constant;

import lombok.Getter;

/**
 * 用户提问回答表缓存key
 *
 * @author xuanqicheng
 * @create 2018-24-09:38
 */
public interface QuestionAndAnswerInfoRedisKey {


    /**
     * 根据问题id查询缓存
     */
    enum QuestionAndAndwserInfoByQuestionIdEnum{

        /**
         * 根据问题id查询缓存
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY+"QuestionAndAndwserInfoByQuestionId:%s",
                "根据问题id查询缓存,string结构,key的格式为 QuestionAndAndwserInfoByQuestionId:{问题id}");

        private String key;

        private String message;

        QuestionAndAndwserInfoByQuestionIdEnum(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(String questionId){
            return String.format(REDIS_KEY.key,questionId);
        }
    }



    /**
     * 回答偷听次数
     * 格式：QuestionAndAndwserNumber:{问题id}
     */
    enum QuestionAndAndwserEavesdroppedNumberEnum{

        /**
         * 回答偷听次数
         * 格式：QuestionAndAndwserNumber:{问题id}
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY +
                "QuestionAndAndwserEavesdroppedNumber:%s","回答偷听次数,string结构,key的格式QuestionAndAndwserNumber:{问题id}");

        private String key;

        private String message;

        QuestionAndAndwserEavesdroppedNumberEnum(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(String questionId){
            return String.format(REDIS_KEY.key,questionId);
        }
    }


    /**
     *偷听人数详情缓存key
     */
    enum QuestionAndAndwserEavesdropedUserEnum{
        /**
         * 偷听人数详情缓存key
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "QuestionAndAndwserEavesdropedUser:%s",
                "偷听人数详情缓存，set结构,格式：QuestionAndAndwserEavesdropedUser:{问题id}");

        private String key;

        private String message;

        QuestionAndAndwserEavesdropedUserEnum(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(String questionId){
            return String.format(REDIS_KEY.key,questionId);
        }

    }

    /**
     * 优质回答列表
     */
    enum QuestionAndAndwserByHighQuality{

        /**
         * 优质回答列表
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY+"QuestionAndAndwserByHighQualityInfo",
                "优质回答列表，string结构，key格式：QuestionAndAndwserByHighQualityInfo");

        private String key;

        private String message;

        QuestionAndAndwserByHighQuality(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(){
            return REDIS_KEY.key;
        }

    }

}
